﻿using System.Collections.Generic;

namespace CoreLims.Models.CoreLims
{
    public partial class INV
    {
        public class MaterialType1Compare : IEqualityComparer<Material>
        {
            bool IEqualityComparer<Material>.Equals(Material x, Material y)
            {
                return x.Type1 == y.Type1;
            }

            int IEqualityComparer<Material>.GetHashCode(Material obj)
            {
                if (string.IsNullOrEmpty(obj.Type1))
                { return 0; }
                else
                { return obj.Type1.Length; }
            }
        }

        public class MaterialType2Compare : IEqualityComparer<Material>
        {
            bool IEqualityComparer<Material>.Equals(Material x, Material y)
            {
                return x.Type2 == y.Type2;
            }

            int IEqualityComparer<Material>.GetHashCode(Material obj)
            {
                if (string.IsNullOrEmpty(obj.Type2))
                { return 0; }
                else
                { return obj.Type2.Length; }
            }
        }

    }
}
